package senpec.qc.harmony.base.mybatisplus;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

@Slf4j
@RequiredArgsConstructor
public abstract class IBaseControllerImpl<T extends IBaseEntity<T>, M extends IBaseService<T>> implements IBaseController<T> {
    private final M baseService;

    @Override
    public Result<T> getById(Long id) {
        return baseService.getById(id);
    }

    @Override
    public Result<T> getOneByCondition(String columnName, Object columnValue) {
        return baseService.getOneByCondition(columnName, columnValue);
    }

    @Override
    public Result<T> getOneByConditions(T conditions) {
        return baseService.getOneByConditions(conditions);
    }

    @Override
    public Result<List<T>> getListByCondition(String columnName, Object columnValue) {
        return baseService.getListByCondition(columnName, columnValue);
    }

    @Override
    public Result<List<T>> getListByConditions(T conditions) {
        return baseService.getListByConditions(conditions);
    }

    @Override
    public Result<T> insertOne(T entity) {
        return baseService.insertOne(entity);
    }

    @Override
    public Result<T> updateOne(T entity) {
        return baseService.updateOne(entity);
    }

    @Override
    public Result<?> physicalDeleteById(Long id) {
        return baseService.physicalDeleteById(id);
    }

    @Override
    public Result<?> logicalDeleteById(Long id) {
        return baseService.logicalDeleteById(id);
    }

    @Override
    public Result<?> activeById(Long id) {
        return baseService.activeById(id);
    }


}
